home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 21
/
Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso
/
Aminet
/
comm
/
cnet
/
viewlog.lha
/
viewlog5
/
VL_AMaint
< prev
next >
Wrap
Text File
|
1996-11-08
|
6KB
|
132 lines
/**************************************************************************\
$VER: ViewLog AMaint, v5.02 (8-Nov-96) by Dotoran of Frontiers!
\**************************************************************************/
options results ; signal on SYNTAX ; signal on ERROR ; signal on IOERR
tr=transmit ; se=sendstring ; gc=getchar ; gu=getuser ; gs=getscratch
a="rexxsupport.library";if ~show("l",a) then if ~addlib(a,0,-30) then exit
ver="5.02" ; changewhere "ViewLog5 AMaint" ; zy=0
BEGIN: ; call READCONFIG ; call CHECKVER ; call READDATA
call DELETE("sysdata:log/ViewLog5")
call LOG("[*] View Log, v"ver" AutoMaintenance started...")
/* Check for NEW logs */
a=showdir("SysData:Log/","F");se "n1Checking for new logs..."
c=0 ; zz="" ; do i=1 to logs ; zz=zz||logF.i" " ; end i
do i=1 to words(a) ; se TWIRL()
if find(zz,word(a,i))=0 then do ; c=c+1 ; l.c=word(a,i) ; end
end i
if c>0 then do
tr "n2New logs found:" ; do i=1 to c ; tr " "l.i
call LOG("[N] Found and added the new log `"l.i"' to ViewLog5.") ; end i
se "n1Adding these logs to data files..."
call open(f1,comP"VL_Data2","r") ; z=readln(f1)
do i=1 until eof(f1) ; z.i=readln(f1) ; end i ; zz=i-1
call close(f1) ; call open(f1,comP"VL_Data2","w")
call writeln(f1,z+c) ; do i=1 to zz ; call writeln(f1,z.i) ; end i
do i=1 to c ; call writeln(f1,l.i) ; end i
call close(f1)
call open(f1,comP"VL_Titles","a")
do i=1 to c ; call writeln(f1,left(z+1,4)l.i) ; end i
call close(f1)
address command "SORT "comP"VL_Titles "comP"VL_Titles COLSTART 5"
do i=1 to c ; zz=logs+i
log.zz=left(z+i,4)left(l.i,15)left(l.i,15)left("31",15)left("31",90)
log.zz=log.zz||left(trim,2)left(trln,3)left(logH,2)left(hisT,4)
log.zz=log.zz||left("1",2)l.i ; end i ; logs=logs+c
call open(f1,comP"VL_Data","w") ; do i=1 to logs ; se TWIRL()
call writeln(f1,log.i) ; end i
call close(f1)
address command "SORT "comP"VL_Data "comP"VL_Data COLSTART 5"
tr "Done." ; signal BEGIN
end
else tr "No new logs found."
/* Trim ALL Logs */
tr "n1Trimming Logs...n1"
do i=1 to logs
if ~exists("sysdata:log/"logF.i) | trim.i=1 then iterate i
se "Reading `"logN.i"' log...@4"
call open(f1,"sysdata:log/"logF.i,"r")
do j=1 until eof(f1) ; se TWIRL() ; l.j=readln(f1) ; end j ; l=j-1
call close(f1)
if l>trln.i then do ; se "trimming "l-trln.i" lines..."
call LOG("[A] Trimmed "l-trln.i" lines from the `"logN.i"' log file.")
call open(f1,"sysdata:log/"logF.i,"w")
do j=l-trln.i+1 to l ; se TWIRL() ; call writeln(f1,l.j) ; end j
call close(f1) ; end
if logH.i=1 & l>trln.i then do;se "appending to history..."
call LOG("[A] Appended "l-trln.i" lines to the `"logN.i"' log history.")
call open(f1,comP"Histories/"logF.i,substr("wa",exists(comP"Histories/"logF.i)+1,1))
do j=1 to l-trln.i ; se TWIRL() ; call writeln(f1,l.j) ; end j
call close(f1) ; end ; tr "Done!"
end i
/* Trim ALL Histories */
tr "n1Trimming Histories...n1"
do i=1 to logs
if ~exists(comP"Histories/"logF.i) | trim.i=1 | hisT.i=0 then iterate i
se "Reading `"logN.i"' history...@4"
call open(f1,comP"Histories/"logF.i,"r")
do j=1 until eof(f1) ; se TWIRL() ; l.j=readln(f1) ; end j ; l=j-1
call close(f1)
if l>hisT.i then do;se "trimming "l-hisT.i" lines..."
call LOG("[A] Trimmed "l-hisT.i" lines from the `"logN.i"' log history.")
call open(f1,comP"Histories/"logF.i,"w")
do j=l-hisT.i+1 to l ; se TWIRL() ; call writeln(f1,l.j) ; end j
call close(f1) ; end ; tr "Done!"
end i
tr "n1ViewLog, v"ver" AutoMaintenance Completed!"
call LOG("[*] View Log, v"ver" AutoMaintenance finished...")
call MAKELOG ; exit
READCONFIG:;gu 1311992;comP=result
tr "f1cbViewLog, v"ver" AutoMaintenance...n1"
call open(f1,comP"ViewLog5.cfg","r")
vers=readln(f1) ; macc=readln(f1)
uacc=readln(f1) ; trim=readln(f1) ; trln=readln(f1)
logH=readln(f1) ; hisP=readln(f1) ; hisT=readln(f1)
ETex=readln(f1)
ARus=readln(f1);ARsy=readln(f1);ARpt=readln(f1)
call close(f1)
return
CHECKVER: ; if ver=vers then return
tr "f1n6c9Version Conflict:n1"
tr " `ViewLog5.cfg' version: v"vers
tr " `VL_AMaint' version: v"ver
tr "n1 BOTH files above need to be v"max(ver,vers)"!"
tr "n1Halting, due to conflicting versions..."
exit
READDATA:
if ~exists(comP"VL_Data") then exit
call open(f1,comP"VL_Data","r") ; tw=0 ; se "Reading logs..."
do i=1 until eof(f1) ; log.i=readln(f1) ; se TWIRL()
parse var log.i 1 logI.i . 5 logN.i . 20 logF.i . 35 uacc.i .,
50 uac.i" " 138 trim.i . 140 trln.i . 143 logH.i .,
145 hisT.i . 149 sysM.i . 151 asoc.i
end i ; logs=i-1 ; tr "Done!"
call close(f1)
return
TWIRL:;sh="--\\||//";tw=tw+1;if tw>8 then tw=1;return substr(sh,tw,1)"<1"
LOG:;parse arg text;zy=zy+1;text.zy="AUTO: ("date("u")" "time("c")")"text;return
MAKELOG:;call open(f9,"SysData:Log/ViewLog5",substr("wa",exists("sysdata:log/viewlog5")+1,1))
do i=1 to zy;call writeln(f9,text.i);end i;call close(f9);return
exit
SYNTAX:;ERROR:;IOERR:;e1=' Error: 'rc' ('errortext(rc)')'
e2=' Line: 'left(sigl,4)'File:';gu 1311992;a=result;gu 1311960
b=result;c='"'a||b'"';e2=e2' 'c;tr e1;tr e2;logentry e1;logentry e2
e=translate(sourceline(sigl),"\{","");do while e~=''
e3='Source: 'left(e,37);tr e3;logentry e3;e=substr(e,38);end;bufferflush
/**************************************************************************\
\****************************************** Frontiers BBS (716)/823-9892 **/